package cn.ycxy.lbl.member.config;

import com.easemob.im.server.EMProperties;
import com.easemob.im.server.EMService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IMConfig {

    @Value("${im.appKey}")
    private String appKey;
    @Value("${im.clientId}")
    private String clientId;
    @Value("${im.clientSecret}")
    private String clientSecret;

    @Bean
    public EMService service() {
        EMProperties properties = EMProperties.builder()
                .setAppkey(appKey)
                .setClientId(clientId)
                .setClientSecret(clientSecret)
                .build();

        return new EMService(properties);
    }
}
